package com.by.controller;

import com.by.common.bean.ResultBean;
import com.by.common.controller.BaseController;
import com.by.pojo.entity.Dept;
import com.by.service.DeptService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "部门接口")
@RestController
@RequestMapping("/api")
public class DeptController extends BaseController {

    private final DeptService deptService;

    @Autowired
    public DeptController(DeptService deptService) {
        this.deptService = deptService;
    }


    @ApiOperation("查询部门列表")
    @GetMapping("/dept/list")
    public ResultBean<List<Dept>> selectDeptList() {
        List<Dept> ans = deptService.selectDeptList();
        return success("部门列表", ans);
    }

}
